package com.ldn.server.boot3.starter.interceptor;

import cn.dev33.satoken.same.SaSameUtil;
import cn.dev33.satoken.stp.StpUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author 李大牛家的牛 (scafel@163.com)
 * @product serverless
 * @className MyFeignRequestInterceptor
 * @createDate 2025/4/15 - 9:44
 * @description ToDo...
 **/
@Component
@Slf4j
public class MyFeignRequestInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        template.header(SaSameUtil.SAME_TOKEN, SaSameUtil.getToken());
        template.header(StpUtil.getTokenName(), StpUtil.getTokenValue());
    }

}
